﻿
-- 人员详细考勤表
create procedure [dbo].[Report_Ryxx]
@qybmm varchar(100) = null,
@begindate datetime = null,
@enddate datetime = null
as
select aa.xm,aa.sfzh,kqsj,isnull(gs,0) gs
from
(
select xm,sfzh from vRyBzInfo
where @qybmm is null or isnull(bzmc,'未知')=@qybmm
) aa
left join
(
select xm,sfzh,kqsj,sum(ljgs/3600) gs
from Compute_Rygs
where (@qybmm is null or qybmm=@qybmm) and (@begindate is null or kqsj>=@begindate)
and (@enddate is null or kqsj<=@enddate)
group by xm,sfzh,kqsj
) bb on(aa.sfzh=bb.sfzh)